Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python version actions #172

Merged
merged 3 commits into from
Dec 26, 2024
Merged

Add python version actions #172

merged 3 commits into from
Dec 26, 2024

Conversation

pachCode
Copy link
Member

@pachCode pachCode commented Dec 26, 2024

Summary by CodeRabbit

  • Chores
    • Expanded the Python version matrix in the CI testing workflow to include versions 3.9 through 3.13.
    • Adjusted formatting in the coverage job token line for consistency.
    • Upgraded several Python packages in the testing requirements to their latest versions, including pytest, pytest-cov, black, isort, flake8, and mypy.

@pachCode pachCode requested a review from felipao-mx December 26, 2024 16:55
@pachCode pachCode self-assigned this Dec 26, 2024
Copy link

coderabbitai bot commented Dec 26, 2024

Walkthrough

The pull request modifies the GitHub Actions workflow configuration file .github/workflows/test.yml. The primary change involves expanding the Python version matrix for the pytest job from two versions (3.7 and 3.8) to a broader range that now includes Python versions 3.9, 3.10, 3.11, 3.12, and 3.13. The coverage job remains functionally unchanged, although a minor formatting adjustment has been made to the token line. Additionally, the requirements-test.txt file has been updated to reflect version upgrades for several Python packages: pytest to 7.4.4, pytest-cov to 4.1.0, black to 22.8.0, isort to 5.11.5, flake8 to 5.0.4, and mypy to 1.4.1. No alterations were made to the declarations of exported or public entities.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1815e70 and b956a61.

📒 Files selected for processing (2)
  • .github/workflows/test.yml (2 hunks)
  • requirements-test.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/test.yml
  • requirements-test.txt

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Dec 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (cc739b8) to head (b956a61).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #172   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines           99        99           
=========================================
  Hits            99        99           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc739b8...b956a61. Read the comment docs.

felipao-mx
felipao-mx previously approved these changes Dec 26, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/test.yml (1)

Line range hint 1-54: Consider additional workflow improvements

While not directly related to the Python version changes, here are some suggestions to improve the workflow:

  1. Consider restricting the workflow to specific branches or adding pull_request trigger
  2. Update other outdated actions:
    • actions/checkout@v2actions/checkout@v4
    • codecov/[email protected]codecov/codecov-action@v4

Apply these changes to update the actions:

-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v4
-        uses: codecov/[email protected]
+        uses: codecov/codecov-action@v4
🧰 Tools
🪛 actionlint (1.7.4)

25-25: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7fadcc and 8a6df65.

📒 Files selected for processing (1)
  • .github/workflows/test.yml (2 hunks)
🔇 Additional comments (2)
.github/workflows/test.yml (2)

54-54: LGTM! Token formatting looks good

The Codecov token is properly secured using GitHub secrets.


23-23: ⚠️ Potential issue

Review Python version compatibility and update action versions

There are several concerns with the current Python version matrix:

  1. Python 3.13 is not yet released and will cause CI failures
  2. Python 3.7 reached end-of-life (EOL) on June 27, 2023
  3. The actions/setup-python action is using an outdated version (v2.2.1)

Apply this diff to address these issues:

-        python-version: [3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13]
+        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

Also, update the action version in all jobs:

-      uses: actions/[email protected]
+      uses: actions/setup-python@v5

Let's verify the Python version support in your project:

✅ Verification successful

Review Python version compatibility and update action versions

Based on the codebase analysis:

  1. The project uses features that require Python 3.6+ (f-strings)
  2. Uses typing features and Pydantic v1 (requires Python 3.6.1+)
  3. Dependencies indicate a stable environment:
    • pytest 6.2.x
    • pydantic 1.9.0
    • mypy 0.790

Recommendations:

  • Remove Python 3.7 as it's EOL
  • Remove Python 3.13 as it's not released
  • Keep Python 3.8 through 3.12
  • Update actions/setup-python to v5

Apply this diff:

-        python-version: [3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13]
+        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

Also update the action version:

-      uses: actions/[email protected]
+      uses: actions/setup-python@v5
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there's any Python version constraint in setup.py or pyproject.toml
fd -e toml -e py -x grep -l "python_requires" {} \;

# Check for version-specific imports or syntax
rg -g '!.git' -g '*.py' "match.*case|match .*:|type.*annotations|ParamSpec|TypeVarTuple|assert.*type|Self"

Length of output: 163


Script:

#!/bin/bash
# Let's try a different approach to check Python version requirements

# Check setup.py if it exists
fd "setup.py$" -x cat {}

# Check pyproject.toml if it exists
fd "pyproject.toml$" -x cat {}

# Check for any requirements files
fd "requirements.*\.txt$" -x cat {}

# Look for type hints usage that might indicate minimum Python version
rg "from typing import" -g "*.py"

# Look for f-strings (Python 3.6+)
rg "f['\"]" -g "*.py"

# Look for async/await (Python 3.5+)
rg "async def|await " -g "*.py"

Length of output: 1379

@felipao-mx felipao-mx force-pushed the python-version-actions branch from 1815e70 to b956a61 Compare December 26, 2024 17:55
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
requirements-test.txt (1)

1-6: Consider adding package constraints

Given the expanded Python version support (3.7-3.13), consider using version ranges (e.g., >=7.4.4,<8.0.0) instead of pinned versions to allow for compatible updates while preventing breaking changes.

Example format:

-pytest==7.4.4
+pytest>=7.4.4,<8.0.0
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c24be2 and 1815e70.

📒 Files selected for processing (1)
  • requirements-test.txt (1 hunks)
🔇 Additional comments (3)
requirements-test.txt (3)

3-4: LGTM: Minor version updates for formatting tools

The updates to black (22.8.0) and isort (5.11.5) are minor version changes within their respective major versions, maintaining backward compatibility.


5-6: Verify breaking changes in linting and type checking tools

The major version updates to flake8 (5.0.4) and mypy (1.4.1) might introduce breaking changes in linting rules and type checking behavior.

✅ Verification successful

Proceed with the version updates - no significant impact expected

The codebase has minimal type hint usage and no linter configuration files were found. The existing type hints are basic and stable across mypy versions:

  • Simple return type annotations (-> str, -> bool)
  • Basic type hints from typing module (Union[str, List[int]])

These patterns are well-established and supported across mypy versions. The flake8 update is also safe as there's no custom configuration that could be affected by rule changes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for breaking changes in flake8 and mypy

# Search for any .flake8 or mypy configuration files
echo "Checking for linter configurations:"
fd -e .flake8 -e mypy.ini -e .mypy.ini

# Check Python files for potential type hints usage
echo "Checking for type hint usage that might be affected by mypy update:"
rg -l "typing\." -t py

# Check for common type annotation patterns
ast-grep --pattern 'def $_($_: $_) -> $_: $$$'

Length of output: 2470


1-2: Verify pytest and pytest-cov compatibility

Both pytest and pytest-cov have undergone major version updates. While pytest 7.4.4 supports Python 3.7+ as intended, let's verify the compatibility matrix.

✅ Verification successful

Let me try another verification approach to check for compatibility issues.


✅ pytest and pytest-cov updates are compatible and safe

Based on the verification results:

  • Both pytest 7.4.4 and pytest-cov 4.1.0 support Python >=3.7, which aligns with the project's requirements
  • The test files use basic pytest features (imports and fixtures) that are stable across major versions
  • The pytest configuration in setup.cfg uses standard pytest-cov options that are supported in both v2.x and v4.x
  • No complex or deprecated pytest features are being used that could be affected by the version updates
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check compatibility between pytest, pytest-cov, and Python versions

# Check pytest compatibility info
curl -s https://pypi.org/pypi/pytest/7.4.4/json | jq -r '.info.requires_python'

# Check pytest-cov compatibility info
curl -s https://pypi.org/pypi/pytest-cov/4.1.0/json | jq -r '.info.requires_python'

# Check for any known issues between these versions
gh search issues "pytest 7.4.4 pytest-cov 4.1.0" --repo pytest-dev/pytest --repo pytest-dev/pytest-cov --state all

Length of output: 3008


Script:

#!/bin/bash
# Check for any test files that might be affected by the pytest version update
fd -e py "test_.*\.py|.*_test\.py" --exec head -n 20 {}

# Look for any pytest specific features or decorators in use
rg -l "@pytest\." 

# Check for pytest-cov configuration in pytest.ini or setup.cfg
fd "pytest.ini|setup.cfg|pyproject.toml" --exec cat {}

Length of output: 1332

@pachCode pachCode merged commit cd31bec into main Dec 26, 2024
15 checks passed
@pachCode pachCode deleted the python-version-actions branch December 26, 2024 18:05
gmorales96 pushed a commit that referenced this pull request Dec 27, 2024
* Add python version actions

* Update test.yml

* update test deps

---------

Co-authored-by: Felipe López <[email protected]>
@coderabbitai coderabbitai bot mentioned this pull request Dec 27, 2024
gmorales96 pushed a commit that referenced this pull request Dec 27, 2024
* Add python version actions

* Update test.yml

* update test deps

---------

Co-authored-by: Felipe López <[email protected]>
pachCode added a commit that referenced this pull request Dec 30, 2024
* Upgrade Python version requirements and dependencies

- Updated Python version from 3.7 to 3.8 in Makefile and README.md.
- Upgraded Pydantic dependency from 1.9.0 to 2.10.3 in requirements.txt and setup.py.
- Updated mypy version from 0.790 to 1.13.0 in requirements-test.txt.
- Refactored CLABE validation logic in types.py, removing custom error classes and integrating Pydantic's validation features.
- Removed unused error handling code and updated tests to reflect changes in validation logic.
- Updated GitHub Actions workflow to support Python versions 3.8 through 3.13.
- Bumped version to 2.0.0.dev0 in version.py.

* Update GitHub Actions workflow to use string format for Python versions

* Update GitHub Actions workflow to include Python 3.13 in the testing

* Add python version actions (#172)

* Add python version actions

* Update test.yml

* update test deps

---------

Co-authored-by: Felipe López <[email protected]>

* Upgrade Python version requirements and dependencies

- Updated Python version from 3.7 to 3.8 in Makefile and README.md.
- Upgraded Pydantic dependency from 1.9.0 to 2.10.3 in requirements.txt and setup.py.
- Updated mypy version from 0.790 to 1.13.0 in requirements-test.txt.
- Refactored CLABE validation logic in types.py, removing custom error classes and integrating Pydantic's validation features.
- Removed unused error handling code and updated tests to reflect changes in validation logic.
- Updated GitHub Actions workflow to support Python versions 3.8 through 3.13.
- Bumped version to 2.0.0.dev0 in version.py.

* Changed regex to pattern in BankConfigRequest model

* Update README; bump version to 2.0.0

* Update GitHub Actions workflow to remove Python 3.7 from the testing matrix, supporting versions 3.8 through 3.13.

* This change enhances compatibility with Pydantic V2 and streamlines error handling.

* Update setup.py to require Python 3.8 and bump version to 2.0.0

* Enhance README with Pydantic v2 usage examples and update CLABE validation logic

* Fix code block formatting in README.md for Pydantic example

* Removing redundant test case

---------

Co-authored-by: gabino <[email protected]>
Co-authored-by: Pach <[email protected]>
Co-authored-by: Felipe López <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants